1 /*
2  * Copyright (c) 2013 - Andre Roth <neolynx@gmail.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation version 2.1 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  * Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
17  *
18  * Described at ETSI EN 300 468 V1.11.1 (2010-04)
19  */
20 
21 /**
22  * @file desc_ca_identifier.h
23  * @ingroup descriptors
24  * @brief Provides the descriptors for the Conditional Access identifier
25  * @copyright GNU Lesser General Public License version 2.1 (LGPLv2.1)
26  * @author Andre Roth
27  *
28  * @par Relevant specs
29  * The descriptor described herein is defined at:
30  * - ETSI EN 300 468 V1.11.1 (2010-04)
31  *
32  * @par Bug Report
33  * Please submit bug reports and patches to linux-media@vger.kernel.org
34  */
35 
36 module libdvbv5_d.desc_ca_identifier;
37 
38 import libdvbv5_d.descriptors: dvb_desc;
39 import libdvbv5_d.dvb_fe: dvb_v5_fe_parms;
40 
41 extern (C):
42 
43 /**
44  * @struct dvb_desc_ca_identifier
45  * @ingroup descriptors
46  * @brief Indicates if a particular bouquet, service or event is associated
47  *	  with a CA system
48  *
49  * @param type			descriptor tag
50  * @param length		descriptor length
51  * @param next			pointer to struct dvb_desc
52  * @param caid_count		Number of CA IDs
53  * @param caids			CA Identifier IDs
54  */
55 struct dvb_desc_ca_identifier
56 {
57     align (1):
58 
59     ubyte type;
60     ubyte length;
61     dvb_desc* next;
62 
63     ubyte caid_count;
64     ushort* caids;
65 }
66 
67 // struct dvb_v5_fe_parms;
68 
69 /** @brief initial descriptor field at dvb_desc_ca_identifier struct */
70 // enum dvb_desc_ca_identifier_field_first = ca_id;
71 /** @brief last descriptor field at dvb_desc_ca_identifier struct */
72 // enum dvb_desc_ca_identifier_field_last = privdata;
73 
74 /**
75  * @brief Initializes and parses the CA identifier descriptor
76  * @ingroup descriptors
77  *
78  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
79  * @param buf	buffer containing the descriptor's raw data
80  * @param desc	pointer to struct dvb_desc to be allocated and filled
81  *
82  * This function allocates a the descriptor and fills the fields inside
83  * the struct. It also makes sure that all fields will follow the CPU
84  * endianness. Due to that, the content of the buffer may change.
85  *
86  * @return On success, it returns the size of the allocated struct.
87  *	   A negative value indicates an error.
88  */
89 int dvb_desc_ca_identifier_init (
90     dvb_v5_fe_parms* parms,
91     const(ubyte)* buf,
92     dvb_desc* desc);
93 
94 /**
95  * @brief Prints the content of the CA identifier descriptor
96  * @ingroup descriptors
97  *
98  * @param parms	struct dvb_v5_fe_parms pointer to the opened device
99  * @param desc	pointer to struct dvb_desc
100  */
101 void dvb_desc_ca_identifier_print (
102     dvb_v5_fe_parms* parms,
103     const(dvb_desc)* desc);
104 
105 /**
106  * @brief Frees all data allocated by the CA identifier descriptor
107  * @ingroup descriptors
108  *
109  * @param desc pointer to struct dvb_desc to be freed
110  */
111 void dvb_desc_ca_identifier_free (dvb_desc* desc);